<script src="Libraries/js/js.js"></script>
<script type="text/javascript" src="Libraries/js/jquery.min.js"></script>
<script type="text/javascript" src="Libraries/js/jquery.datepick.js"></script>
<script type="text/javascript" src="Libraries/nicEdit/nicEdit.js"></script>
<script type="text/javascript">
	//bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
	//bkLib.onDomLoaded(function() { nicEditors.findEditor('txtnoidung')});
	//var area1;
	bkLib.onDomLoaded(function() { var area1 = new nicEditor({fullPanel : true}).panelInstance('txtnoidung',{hasPanel : true}); });

	


   	
   	function checkChonLopHP(){
		
		for (var i=0; i<document.ghinhatkigiangday.rdomalophp.length; i++){
			
			var isOk = false;
       		if ( document.ghinhatkigiangday.rdomalophp[i].checked == true){
				isOk = true;
            	
				break;   
       		}
			
    	}
    	if (isOk==false){
			alert("Xin chọn lớp học phần cần ghi nhật kí!");
			return false;
		}
		return true;
	}
	function getValue(id){
		for(var i=0;i<document.ghinhatkigiangday.cbotuan.length;i++){
			if(document.ghinhatkigiangday.cbotuan[i].value==document.getElementById("tuan" + id).innerHTML){
				document.ghinhatkigiangday.cbotuan.selectedIndex=i;
				break;
			}
		}
		for(var i=0;i<document.ghinhatkigiangday.cbothu.length;i++){
			if(document.ghinhatkigiangday.cbothu[i].value==document.getElementById("thu" + id).innerHTML){
				document.ghinhatkigiangday.cbothu.selectedIndex=i;
				break;
			}
		}
		for(var i=0;i<document.ghinhatkigiangday.cbosotiet.length;i++){
			if(document.ghinhatkigiangday.cbosotiet[i].value==document.getElementById("sotiet" + id).innerHTML){
				document.ghinhatkigiangday.cbosotiet.selectedIndex=i;
				break;
			}
		}
		for(var i=0;i<document.ghinhatkigiangday.cbohinhthucday.length;i++){
			if(document.ghinhatkigiangday.cbohinhthucday[i].value==document.getElementById("hinhthucday" + id).innerHTML){
				document.ghinhatkigiangday.cbohinhthucday.selectedIndex=i;
				break;
			}
		}
		nicEditors.findEditor('txtnoidung').setContent(document.getElementById("noidung" + id).innerHTML);
		document.ghinhatkigiangday.txtngay.value=document.getElementById("ngay" + id).innerHTML;
		
		document.ghinhatkigiangday.txtsosvhiendien.value=document.getElementById("sosvhiendien" + id).innerHTML;
		document.ghinhatkigiangday.txtxacnhancuasv.value=document.getElementById("xacnhancuasv" + id).innerHTML;
		document.ghinhatkigiangday.btnsuankct.disabled = false;
		document.ghinhatkigiangday.btnxoankct.disabled = false;
		
	}
	function checkField(){
		var thu = document.ghinhatkigiangday.cbothu.selectedIndex;
		var tuan = document.ghinhatkigiangday.cbotuan.selectedIndex;
		var sosv = document.ghinhatkigiangday.txtsosvhiendien.value;
		var hinhthucday = document.ghinhatkigiangday.cbohinhthucday.selectedIndex;
		var ngay = document.ghinhatkigiangday.txtngay.value;
		var sotiet = document.ghinhatkigiangday.cbosotiet.selectedIndex;
	
		if (thu == 0 || tuan == 0 || hinhthucday == 0 || sotiet == 0 ||  ngay == "" || sosv=="" ){
			alert("Xin nhập đầy đủ thông tin được yêu cầu!");
			return false;
		}
		return true;
	}
	function checkFieldGhiXNCuaSV(){
		
		if (document.ghinhatkigiangday.rdonkct.checked == false)
		{
			alert("Xin chọn lớp học phần cần ghi nhật kí!");
			return false;
		}
		else{
			if (document.ghinhatkigiangday.txtxacnhancuasv.value == ""){
				alert("Xin vui lòng nhập thông tin vao mục xác nhận của sinh viên!");
				return false;
				
			}
		}
	
		return true;
	}
    function confirmDelete(){
         if (confirm("Bạn có chắc muốn xóa nhật kí chi tiết này không?")){
            return true;
         }
         return false;
    }
    function confirmUpdate(){
         if (confirm("Bạn có chắc muốn xóa nhật kí chi tiết này không?")){
            return true;
         }
         return false;
    }
	function checkFieldGiaiTrinh(){	
		
		if (document.ghinhatkigiangday.txtgiaitrinh.value.length<=0){
			alert("Xin vui lòng nhập thông tin vào mục Ghi nhận/Giải trình/Đề nghị!");
			return false;			
		}
		return true;
	
    }
    function checkFieldGhiNXCuaBM(){				
		if (document.ghinhatkigiangday.txtnhanxetcuabm.value == ""){
			alert("Xin vui lòng nhập thông tin vào mục nhận xét của Bộ môn!");
			return false;			
		}
		return true;
	
    }
	function checkFieldGhiNXCuaDV(){				
		if (document.ghinhatkigiangday.txtnhanxetcuadv.value == ""){
			alert("Xin vui lòng nhập thông tin vào mục nhận xét của Đơn vị!");
			return false;			
		}
		return true;
    }
	function empty(){
	   //alert()
		document.ghinhatkigiangday.cbotuan.selectedIndex = 0;
		document.ghinhatkigiangday.cbothu.selectedIndex = 0;
		document.ghinhatkigiangday.cbosotiet.selectedIndex = 0;
		document.ghinhatkigiangday.cbohinhthucday.selectedIndex = 0;
		nicEditors.findEditor('txtnoidung').setContent("");
		document.ghinhatkigiangday.txtngay.value="";
		document.ghinhatkigiangday.txtsosvhiendien.value="";
		document.ghinhatkigiangday.txtxacnhancuasv.value="";
		
        document.ghinhatkigiangday.btnsuankct.disabled = true;
        document.ghinhatkigiangday.btnxoankct.disabled = true;
		for (var i=0; i<document.ghinhatkigiangday.rdonkct.length; i++){
			
			
       		if ( document.ghinhatkigiangday.rdonkct[i].checked == true){
				
            	document.ghinhatkigiangday.rdonkct[i].checked = false;
				break;   
       		}
			
    	}
	}
	$(function() {
	
	$('#inlineDatepicker').datepick({onSelect: showDate});
	$('#popupDatepicker').datepick();
	$('#popupDatepicker2').datepick();
});
 
function showDate(date) {
	alert('The date chosen is ' + date);
}
   
</script>
<?php
    include_once('Configs/database.php');
	include_once('Models/HocPhan.php');
	include_once('Configs/paging.php');
    include_once('Models/HocKiNamHoc.php');
    include_once('Models/HPMoVaoHKNH.php');
    include_once('Models/LopHocPhan.php');
    include_once('Models/Khoa.php');
	 include_once('Models/NhatKi.php');
    include_once('Models/NhatKiChiTiet.php');
    
?>
<link href="Libraries/css/jquery.datepick.css" rel="stylesheet" type="text/css"></head>
<form name="ghinhatkigiangday" method="POST">
<table align="center" class="font" width="800" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class=main_1><img border="0" src="Libraries/images/tbl_left.gif" width="10" height="25" /></td>
    <td align=center class=main_1>Ghi Nhật Kí Giảng Dạy Lớp Học Phần </td>
    <td class=main_1><p align="right"><img border="0" src="Libraries/images/tbl_right.gif" width="10" height="25" /></p></td>
  </tr>
  <tr >
    <td class="border_1" colspan="3" valign="top"><table width="100%" border="0" align="center"  >
                <tr>
                    <td width="130%" >&nbsp;</td>
                </tr>
                <tr>
                  <td align="center"><table border="0">
                      <tr>
                        <td>Năm học</td>
                        <td>
							<select name="cbonamhoc" onchange="document.ghinhatkigiangday.cbohocki.selectedIndex=0;">
                          		<option value=" "></option>
                          			<?php
										$hknh = new HocKiNamHoc();
                                		$result = $hknh->dsNamHoc();
                                		while ($rows=mysql_fetch_array($result)){
                                    		echo "<option value='".$rows['namhoc']."'";				
				                    		echo ">".$rows['namhoc']."</option>";
                                		}
                                		if (isset($_POST['cbonamhoc'])){
                                    		echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbonamhoc.length;i++){if(document.ghinhatkigiangday.cbonamhoc[i].value=='$namhoc'){document.ghinhatkigiangday.cbonamhoc.selectedIndex=i;break;}}</script>";
                                		}
                                	?>
                        	</select>						</td>
                        <td>Học kì</td>
                        <td>
							<select name="cbohocki"  onchange="document.ghinhatkigiangday.cbokhoa.selectedIndex=0;">
                          		<option value="0"></option>
                          		<option value="1" <?php if ($_POST['cbohocki']==1) echo "selected='selected'"; ?>>1</option>
                          		<option value="2" <?php if ($_POST['cbohocki']==2) echo "selected='selected'"; ?>>2</option>
                          		<option value="3" <?php if ($_POST['cbohocki']==3) echo "selected='selected'"; ?>>Hè</option>
                        	</select></td>
                        <td>Khoa</td>
                        <td><select name="cbokhoa" onchange="document.ghinhatkigiangday.cbobomon.selectedIndex=0;document.ghinhatkigiangday.submit();">
                          <option value=" "></option>
                          <?php
							$khoa = new Khoa();
							
							$result = $khoa->dsTatCaKhoa();
							while ($rows = mysql_fetch_array($result)){
								echo "<option value='".$rows['makhoa']."'>".$rows['tenkhoa']."</option>";
							}
                            
						?>
                        </select></td>
                        <td>Bộ môn </td>
                        <td><select name="cbobomon" onchange="document.ghinhatkigiangday.submit();">
                          <option value=" "></option>
                          <?php
							if (isset($_POST['cbokhoa'])){
							     echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbokhoa.length;i++){if(document.ghinhatkigiangday.cbokhoa[i].value=='$makhoa'){document.ghinhatkigiangday.cbokhoa.selectedIndex=i;break;}}</script>";
                                $khoa = new Khoa();
                                $khoa->setMaKhoa($makhoa);
                                $result = $khoa->dsBMCuaKhoa();
		                        while ($rows = mysql_fetch_array($result)){
                                    echo "<option value='".$rows['mabm']."'>".$rows['tenbm']."</option>";
		                        }
                                
							}
						  ?>
                        </select></td>
                      </tr>
                    </table>				</td>
               </tr>
              
               <tr>
                 <td align="center">
                 <?php
                   
                    if (isset($_POST['cbokhoa']) && strlen($mabm) > 0){
                        echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbobomon.length;i++){if(document.ghinhatkigiangday.cbobomon[i].value=='$mabm'){document.ghinhatkigiangday.cbobomon.selectedIndex=i;break;}}</script>";
                        $db = new database();
                        $query = "select malophp,kihieu,d.mahp,tenhp, b.maso, concat(holot, ' ', ten) as hoten ";
                        $query .= "from BoMon a, CanBoGiangDay b, CanBo c, LopHocPhan d, HocPhan e ";
                        $query .= "where namhoc='".$namhoc."' and hocki=".$hocki." and a.mabm='".$mabm."' and a.mabm = b.mabm and b.maso = c.maso and b.maso = d.maso and d.mahp = e.mahp order by d.mahp asc";
                        $db->setQuery($query);
                        $result = $db->fetchAll();
                        $i = 0;
                        $numRecord = mysql_num_rows($result);
                        
                          echo "<table width='800' border='0'>";
                           echo "<tr>";
                             echo "<td><div class='panel_cn' style=' border:1 #0099FF;'>";
                               echo "<fieldset>";
                               echo "<legend>Danh sách các lớp học phần </legend>";
                                 echo "<table width='800' class='border_1'  id='tbmain' cellpadding='0' cellspacing='0'>";
                                     echo "<tr>";
                                       echo "<td align='center' width='28' class='main_3' >STT</td>";
                                       echo "<td align='center' class='main_3' width='68'>Lớp HP</td>";
                                       echo "<td align='center' class='main_3' width='22'>Kh</td>";
                                       echo "<td align='center' class='main_3' width='63'>Mã HP</td>";
                                       echo "<td align='center' class='main_3' width='204'>Tên Học Phần</td>";
                                       echo "<td align='center' class='main_3' width='60'>MSCB </td>";
                                       echo "<td align='center' class='main_3' width='146'>Tên Cán Bộ</td>";
                                       echo "<td align='center' class='main_3' width='41'>Chọn</td>";
                                     echo "</tr>";
						 
     	                      if ($numRecord > 0){
                                    while ($rows = mysql_fetch_array($result)){
                                        $i++;
                                        $c = 2-$i%2;
                                   
                               
                                     echo "<tr>";
                                       echo "<td align='center' class='level_1_$c' >".$i."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['malophp']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['kihieu']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['mahp']."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['tenhp']."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['maso']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['hoten']."</td>";
                                       echo "<td align='center'  class='level_1_$c'><input type='radio' name='rdomalophp' value='".$rows['malophp']."'  /></td>";
                                       
                                     echo "</tr>";
									 
                                    }
									echo "<tr>";
                                        echo "<td align='center' colspan='8'><input type='submit' class='button_1' value='Ghi nhật kí' onClick='return checkChonLopHP();'/></td>";
                                       
                                       
                                     echo "</tr>";
                                
                                }
                                else{
                                     echo "<tr>";
                                       echo "<td align='center' class='level_1_$c' colspan='8'>Không có lớp học phần nào.</td>";
                                      
                                     echo "</tr>";
                                }
                               echo "</table>";
                               echo "</fieldset>";
                             echo "</div></td>";
                           echo "</tr>";
                         echo "</table> ";
                        
                        
                    }
                    if (isset($_POST['rdomalophp'])){
                        echo "<script language=\"javascript\">";
                
                        echo "for (var i = 0; i< document.ghinhatkigiangday.rdomalophp.length; i++){";
                        echo "if (document.ghinhatkigiangday.rdomalophp[i].value == '$malophp'){";
                        echo "document.ghinhatkigiangday.rdomalophp[i].checked = true;";
                        echo "break;";
                        echo "}";
                        echo "}";
                      
                        echo "</script>";
                        $nhatki = new NhatKi();
                        $nhatki->setMaLopHP($malophp);
        
						
							
						$result = $nhatki->thongTinNhatKi();
						$rows = mysql_fetch_array($result);
                      
                 ?>                  
                 <table width="800" border="0">
                   <tr>
                     <td colspan="3"><div class="panel_cn" style=" border:1 #0099FF;">
                       <fieldset>
                         <legend>Nhật kí chi tiết </legend>
                         <table width="800" class="border_1"  id="tbmain" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="37" align="center" class="main_3" >Tuần</td>
                            <td width="32" align="center" class="main_3">Thứ</td>
                            <td width="41" align="center" class="main_3">Ngày</td>
                            
                            <td width="46" align="center" class="main_3">Hình thức dạy </td>
							<td width="21" align="center" class="main_3">Số tiết </td>
                            <td width="289" align="center" class="main_3">Nội dung </td>
                            <td width="55" align="center" class="main_3">Số SVHD </td>
                            <td width="120" align="center" class="main_3">Xác nhận của SV </td>
                            <td align="center" class="main_3" width="39">Ch&#7885;n</td>
                          </tr>
						  <?php
                            
						  	$nkct = new NhatKiChiTiet();
							$nkct->setMaLopHP($malophp);
							$resultnkct = $nkct->nhatKiChiTietLopHP();
							$numnkct = mysql_num_rows($resultnkct);
							if ($numnkct > 0){
							$i = 0;
						  	while($rowsnkct = mysql_fetch_array($resultnkct)){
								$i++;
								$c = 2-$i%2;
								if ($rowsnkct['xacnhancuasv']==" ") $xnsv ="Sinh viên chưa xác nhận";
								else $xnsv = $rowsnkct['xacnhancuasv'];
						  
								  echo "<tr>";
									 
									echo "<td align='center' class='level_1_$c'><div id='tuan$i'>".$rowsnkct['tuan']."</div></td>";
									echo "<td align='center' class='level_1_$c'><div id='thu$i'>".$rowsnkct['thu']."</div></td>";
									echo "<td align='center' class='level_1_$c'><div id='ngay$i'>".$rowsnkct['ngay']."</div></td>";
									echo "<td align='center' class='level_1_$c'><div id='hinhthucday$i'>".trim($rowsnkct['hinhthucday'])."</div></td>";
									echo "<td align='center' class='level_1_$c'><div id='sotiet$i'>".$rowsnkct['sotiet']."</div></td>";
									echo "<td class='level_1_$c'><div id='noidung$i'>".trim($rowsnkct['noidung'])."</td>";
									echo "<td align='center' class='level_1_$c'><div id='sosvhiendien$i'>".$rowsnkct['sosvhiendien']."</div></td>";
									echo "<td align='center' class='level_1_$c'><div id='xacnhancuasv$i'>".trim($rowsnkct['xacnhancuasv'])."</div></td>";
									echo "<td align='center'  class='level_1_$c'><input type='radio' name='rdonkct' value='$i'  onClick='getValue(this.value);'/></td>";
								  echo "</tr>";
                          
						 
						  	}
                          }
                          else{
                            echo "<tr>";
                           
                            echo "<td align='center' colspan='9' class='level_1_1'>Chưa ghi nhật kí chi tiết</td>";
                          echo "</tr>";
                          }
                          if (isset($_POST['rdonkct'])){
                                $stt = $_POST['rdonkct'];
                                
                                echo "<script language=\"javascript\">";
                                
                                echo "for (var i = 0; i< document.ghinhatkigiangday.rdonkct.length; i++){";
                                echo "if (document.ghinhatkigiangday.rdonkct[i].value == '$stt'){";
                                echo "document.ghinhatkigiangday.rdonkct[i].checked = true;";
                                echo "break;";
                                echo "}";
                                
                                echo "}";
                              
                                echo "</script>";
                            }
						  ?>
                          <tr>
                            <td colspan="9" align="center" bgcolor="#dae9f3" ><table width="100%" border="0">
                              <tr>
                                <td align="right">Tuần</td>
                                <td><select name="cbotuan">
                                  <option value="0" <?php if ($_POST['cbotuan']==0) echo "selected='selected'"; ?>></option>
                                  <option value="1" <?php if ($_POST['cbotuan']==1) echo "selected='selected'"; ?>>1</option>
                                  <option value="2" <?php if ($_POST['cbotuan']==2) echo "selected='selected'"; ?>>2</option>
                                  <option value="3" <?php if ($_POST['cbotuan']==3) echo "selected='selected'"; ?>>3</option>
                                  <option value="4" <?php if ($_POST['cbotuan']==4) echo "selected='selected'"; ?>>4</option>
                                  <option value="5" <?php if ($_POST['cbotuan']==5) echo "selected='selected'"; ?>>5</option>
                                  <option value="6" <?php if ($_POST['cbotuan']==6) echo "selected='selected'"; ?>>6</option>
                                  <option value="7" <?php if ($_POST['cbotuan']==7) echo "selected='selected'"; ?>>7</option>
                                  <option value="8" <?php if ($_POST['cbotuan']==8) echo "selected='selected'"; ?>>8</option>
                                  <option value="9" <?php if ($_POST['cbotuan']==9) echo "selected='selected'"; ?>>9</option>
                                  <option value="10" <?php if ($_POST['cbotuan']==10) echo "selected='selected'"; ?>>10</option>
                                  <option value="11" <?php if ($_POST['cbotuan']==11) echo "selected='selected'"; ?>>11</option>
                                  <option value="12" <?php if ($_POST['cbotuan']==12) echo "selected='selected'"; ?>>12</option>
                                  <option value="13" <?php if ($_POST['cbotuan']==12) echo "selected='selected'"; ?>>13</option>
                                  <option value="14" <?php if ($_POST['cbotuan']==14) echo "selected='selected'"; ?>>14</option>
                                  <option value="15" <?php if ($_POST['cbotuan']==15) echo "selected='selected'"; ?>>15</option>
                                  <option value="16" <?php if ($_POST['cbotuan']==16) echo "selected='selected'"; ?>>16</option>
                                  <option value="17" <?php if ($_POST['cbotuan']==17) echo "selected='selected'"; ?>>17</option>
                                  <option value="18" <?php if ($_POST['cbotuan']==18) echo "selected='selected'"; ?>>18</option>
                                  <option value="19" <?php if ($_POST['cbotuan']==19) echo "selected='selected'"; ?>>19</option>
                                  <option value="20" <?php if ($_POST['cbotuan']==20) echo "selected='selected'"; ?>>20</option>
                                </select></td>
                                <td align="right">Th&#7913;&nbsp;&nbsp;</td>
                                <td><select name="cbothu">
                                  <option value="0" <?php if ($_POST['cbothu']==0) echo "selected='selected'"; ?>></option>
                                  <option value="2" <?php if ($_POST['cbothu']==2) echo "selected='selected'"; ?>>2</option>
                                  <option value="3" <?php if ($_POST['cbothu']==3) echo "selected='selected'"; ?>>3</option>
                                  <option value="4" <?php if ($_POST['cbothu']==4) echo "selected='selected'"; ?>>4</option>
                                  <option value="5" <?php if ($_POST['cbothu']==5) echo "selected='selected'"; ?>>5</option>
                                  <option value="6" <?php if ($_POST['cbothu']==6) echo "selected='selected'"; ?>>6</option>
                                  <option value="7" <?php if ($_POST['cbothu']==7) echo "selected='selected'"; ?>>7</option>
                                  <option value="8" <?php if ($_POST['cbothu']==8) echo "selected='selected'"; ?>>CN</option>
                                </select></td>
                                <td align="right">Ngày</td>
                                <td>
                                    <input name="txtngay" type="text" id="popupDatepicker" size="12" maxlength="12" readonly="true" style="background-color: #cccccc;"/>
                                    <?php
										if (isset($_POST['txtngay'])){
											echo "<script languge='javascript'>document.ghinhatkigiangday.txtngay.value = '$ngay'</script>";
										}
									?>                                </td>
                                <td align="right">S&#7889; ti&#7871;t</td>
                                <td><select name="cbosotiet" >
                                  <option value="0" <?php if ($_POST['cbosotiet']==0) echo "selected='selected'"; ?>></option>
                                  <option value="1" <?php if ($_POST['cbosotiet']==1) echo "selected='selected'"; ?>>1</option>
                                  <option value="2" <?php if ($_POST['cbosotiet']==2) echo "selected='selected'"; ?>>2</option>
                                  <option value="3" <?php if ($_POST['cbosotiet']==3) echo "selected='selected'"; ?>>3</option>
                                  <option value="4" <?php if ($_POST['cbosotiet']==4) echo "selected='selected'"; ?>>4</option>
                                  <option value="5" <?php if ($_POST['cbosotiet']==5) echo "selected='selected'"; ?>>5</option>
                                </select></td>
                                <td>Số SVHD</td>
                                <td>
									<input name="txtsosvhiendien" type="text" id="txtsosvhiendien"  size="5" />
									<?php
										if (isset($_POST['txtsosvhiendien'])){
											echo "<script languge='javascript'>document.ghinhatkigiangday.txtsosvhiendien.value = '$sosvhiendien'</script>";
										}
									?>								</td>
                                <td>Dạy</td>
                                <td><select name="cbohinhthucday" id="cbohinhthucday">
                                  <option value="" ></option>
                                  <option value="LT" <?php if ($_POST['cbohinhthucday']=="LT") echo "selected='selected'"; ?>>Lí thuyết</option>
                                  <option value="TH" <?php if ($_POST['cbohinhthucday']=="TH") echo "selected='selected'"; ?>>Thực hành</option>
                                </select></td>
                              </tr>
                              <tr>
                                <td colspan="3" align="right">Xác nhận của SV&nbsp;&nbsp;</td>
                                <td colspan="9" align="left">
									<input name="txtxacnhancuasv" type="text" id="txtxacnhancuasv" size="60" disabled="true"/>
									<?php
										if (isset($_POST['txtxacnhancuasv'])){
											echo "<script languge='javascript'>document.ghinhatkigiangday.txtxacnhancuasv.value = '$xacnhancuasv';</script>";
										}
									?>								</td>
                              </tr>
                              <tr>
                                <td colspan="3" align="right">Gợi Ý &nbsp;</td>
                                <td colspan="9" align="left">
                                <select name="cbonoidungvt" onchange="nicEditors.findEditor('txtnoidung').setContent(document.ghinhatkigiangday.cbonoidungvt.value);">
                                    <option value=""></option>
                                  <?php
								  		
										$db = new database();
										$db->setQuery("select mahp from LopHocPhan where malophp='".$malophp."'");
										$resulthp = $db->fetchAll();
										$rowshp= mysql_fetch_array($resulthp);
										$mahp = $rowshp['mahp'];
										$db->setQuery("select noidungvt,noidung from DeCuongHPChiTiet where mahp = '".$mahp."'");
										
										$resultdcct = $db->fetchAll();
										while ($rowsdcct = mysql_fetch_array($resultdcct)){
											echo "<option value='".$rowsdcct['noidung']."'>".$rowsdcct['noidungvt']."</option>";
										}
									?>
                                </select>
                                </td>
                              </tr>

                              <tr>
                                <td colspan="3" align="right">Nội dung chi tiết&nbsp; </td>
                                <td colspan="9">&nbsp;</td>
                              </tr>
                              <tr>
                                <td colspan="3" align="right">&nbsp;</td>
                                <td colspan="9" align="left"><textarea cols="75" rows="5" name="txtnoidung" id="txtnoidung"></textarea>
                                  <?php
										
                                        if (isset($_POST['txtnoidung'])){
                                            
                                            
                                            echo "<script language=\"javascript\">";
                                            
                                            echo " nicEditors.findEditor('txtnoidung').setContent('aaaa');";
                                          
                                            echo "</script>";
                                        }
									?></td>
                              </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td colspan="9" align="center"  >
							<?php
							
							if ($nmaquyen == 'GV' || $nmaquyen=='BM' || $nmaquyen='DV')
							{
							
							?>
								<input name="btntaomoi" type="button" class="button_1" id="btntaomoi" value="Tạo mới" onclick="return empty();"/>
                            	<input name="btnthemnkct" type="submit" class="button_1" value="Thêm" onclick="return checkField();"/>
                              	<input name="btnsuankct" type="submit" class="button_1" value="Sửa" disabled="true" onclick="return checkField();"/>
                              	<input name="btnxoankct" type="submit" class="button_1" value="Xóa" disabled="true" onclick="return confirmDelete();"/>
								
							<?php
							}
							if ($nmaquyen == 'SV'){
							     echo "<script language='javascript'>";
							
							
    							echo "document.ghinhatkigiangday.txtxacnhancuasv.disabled= false ;";     						
    							echo "</script>";
								 echo "<input name='btnxnsv' type='submit' class='button_1' value='Xác nhận của SV' onclick='return checkFieldGhiXNCuaSV();'/>";
							}
                            if (isset($_POST['rdonkct'])){
                                echo "<script language=\"javascript\">";
                                
                              
                                echo "document.ghinhatkigiangday.btnsuankct.disabled = false;";
                                echo "document.ghinhatkigiangday.btnxoankct.disabled = false;";
                                
                              
                                echo "</script>";
                              
							 
							
							} 
							?>							</td>
                          </tr>
                        </table>
                       </fieldset>
                     </div></td>
                   </tr>
                   <tr>
                     <td width="33%"><div class="panel_cn" style=" border:1 #0099FF;">
                       <fieldset>
                       <legend>Ghi nhận/Giải trình/Đề nghị(nếu có) </legend>
                         <table border="0">
                         <tr>
                           <td><textarea name="txtgiaitrinh" cols="27" rows="3" id="txtgiaitrinh" disabled="disabled" style="background: #cccccc;"><?php echo $rows['giaitrinh']?></textarea></td>
                         </tr>
                         <tr>
                           <td align="center"><input name="btncapnhatgiaitrinh" type="submit" class="button_1" id="btncapnhatgiaitrinh" value="Cập nhật" disabled="disabled" onclick="return checkFieldGiaiTrinh();"/></td>
                         </tr>
                       </table>
                       </fieldset>
                     </div></td>
                     <td width="33%"><div class="panel_cn" style=" border:1 #0099FF;">
                       <fieldset>
                       <legend>Nhận xét của Bộ môn </legend>
                         <table border="0">
                         <tr>
                           <td><textarea name="txtnhanxetcuabm" cols="27" rows="3" id="txtnhanxetcuabm" disabled="disabled" style="background: #cccccc;"><?php echo $rows['nhanxetcuabm']?></textarea></td>
                         </tr>
                         <tr>
                           <td align="center"><input name="btncapnhatnxbm" type="submit" class="button_1" id="btncapnhatnxbm" value="Cập nhật" disabled="disabled" onclick="return checkFieldGhiNXCuaBM();"/></td>
                         </tr>
                       </table>
                       </fieldset>
                     </div></td>
                     <td width="33%"><div class="panel_cn" style="border:1 #0099FF;">
                       <fieldset>
                         <legend>Nhận xét của Đơn vị </legend>
                         <table border="0">
                          <tr>
                            <td><textarea name="txtnhanxetcuadv" cols="27" rows="3" id="txtnhanxetcuadv" disabled="true" style="background: #cccccc;"><?php echo $rows['nhanxetcuadv']?></textarea></td>
                          </tr>
                          <tr>
                            <td align="center"><input name="btncapnhatnxdv" type="submit" class="button_1" value="Cập nhật" disabled="true" onclick="return checkFieldGhiNXCuaDV();"/></td>
                          </tr>
                        </table>
                       </fieldset>
                     </div></td>
                   </tr>
                   </table>
                   <?php
				   	//echo $nmaquyen;
				   		/*if ($nmaquyen == 'SV' || $nmaquyen == 'GV'){
							
							echo "<script language='javascript'>";
							
							echo "document.ghinhatkigiangday.txtnhanxetcuabm.disabled='true';";
							echo "document.ghinhatkigiangday.txtnhanxetcuadv.disabled='true';";
							echo "document.ghinhatkigiangday.txtnhanxetcuabm.style.backgroundColor = '#cccccc';";
							echo "document.ghinhatkigiangday.txtnhanxetcuadv.style.backgroundColor = '#cccccc';"; 	 	
    						//echo "document.ghinhatkigiangday.btnsua.disabled=false;"
    						//document.capnhatbm.btnxoa.disabled=false;
							echo "</script>";
						}*/
						if ($nmaquyen == 'GV' || $nmaquyen == 'BM' || $nmaquyen == 'DV'){
							
							echo "<script language='javascript'>";
							
							//echo "document.ghinhatkigiangday.txtnhanxetcuabm.disabled='true';";
							echo "document.ghinhatkigiangday.txtgiaitrinh.disabled= false;";
							echo "document.ghinhatkigiangday.txtgiaitrinh.style.backgroundColor = '#ffffff';";
							//echo "document.ghinhatkigiangday.txtnhanxetcuadv.style.backgroundColor = '#cccccc';"; 	 	
    						echo "document.ghinhatkigiangday.btncapnhatgiaitrinh.disabled=false;";
							
    						//document.capnhatbm.btnxoa.disabled=false;
							echo "</script>";
						}
						if ($nmaquyen == 'BM'){
							
							echo "<script language='javascript'>";
							
							//echo "document.ghinhatkigiangday.txtnhanxetcuabm.disabled='true';";
							echo "document.ghinhatkigiangday.txtnhanxetcuabm.disabled= false;";
							echo "document.ghinhatkigiangday.txtnhanxetcuabm.style.backgroundColor = '#ffffff';";
							//echo "document.ghinhatkigiangday.txtnhanxetcuadv.style.backgroundColor = '#cccccc';"; 	 	
    						echo "document.ghinhatkigiangday.btncapnhatnxbm.disabled=false;";
							
    						//document.capnhatbm.btnxoa.disabled=false;
							echo "</script>";
						}
						if ($nmaquyen == 'DV'){
							
							echo "<script language='javascript'>";
							
							
							echo "document.ghinhatkigiangday.txtnhanxetcuadv.disabled= false ;";
							
							echo "document.ghinhatkigiangday.txtnhanxetcuadv.style.backgroundColor = '#ffffff';"; 	 	
    						echo "document.ghinhatkigiangday.btncapnhatnxdv.disabled = false;";
							//echo "document.ghinhatkigiangday.btncapnhatnxdv.disabled=false;";
    						
							echo "</script>";
						}
                        
                   }
                   ?>
                 </td>
               </tr>
               
                
        </table>
       
           

    </td>
  </tr>
</table>
<br />

<?php
	//echo $malophp;
	if (isset($_POST['btnxem'])){
            
            
            require('Views/Hienthinhatki.php');
        }
?>

 

</form>
